package com.example.springbootmybatis.core.redis;

import com.alibaba.fastjson.JSONObject;
import com.example.springbootmybatis.constant.RedisConstants;
import com.example.springbootmybatis.model.CompanyUser;
import com.example.springbootmybatis.service.RedisService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class RedisCacheService {
    @Resource
    private RedisService redisService;


    /**
     * 更新客户个人信息 通过员工Id
     *
     * @param uid
     * @author Sonya Shang
     */
//    public void cacheCompanyUser(Integer uid, CompanyUser user) {
//        RedisTemplate.REDIS_DB_INDEX.set(RedisConstants.INDEXDB_0);
//        JSONObject jb = new JSONObject();
//        jb.put("type", "companyUser");
//        jb.put("uid", uid);
//        if (redisService.get(RedisConstants.QUARTZ_BASE + uid) == null) {
//
//            redisService.set(RedisConstants.REDIS_COMPANY_USER + uid, jb.toJSONString());
//        } else {
//            redisService.delUser(RedisConstants.REDIS_COMPANY_USER + uid);
//            redisService.set(RedisConstants.REDIS_COMPANY_USER + uid, jb.toJSONString());
//        }
//    }
}
